﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;

namespace TfsBacklogMgr.Main
{
    public class LogManager
    {
        public static Logger GetLogger(string name)
        {
            return new Logger(name);
        }
    }
    public class Logger
    {
        string _name;
        public Logger( string name )
        {
            _name = name;
        }
        public void Trace(string message)
        {
#if DEBUG
            if (string.IsNullOrEmpty(message))
                return;
            Debug.WriteLine(_name + ": " + message);
#endif
        }

        public void TraceException(string msg, Exception e)
        {
#if DEBUG
            Trace(msg);
            if( e != null )
            {
                Trace("  Source: " + e.Source);
                Trace("  Message: " + e.Message);
                Trace("  Stack: " + e.StackTrace);
                if (e.InnerException != null)
                    TraceException("InnerException------- ",  e.InnerException );
            }
#endif
        }
    }
}
